package info.rodinia.tokenmaker;

import java.util.ArrayList;

/** 
 * Equipment models D&D 4E equipment.  
 * All I'm really doing here is keeping an HTML representation of the equipment on the token for ease of look up during the game.
 * @author Blakey - Summer 2010
 *
 */
public class Equipment {
    // compendium info
    private int id = 0;
    private String html = null;
    private String name = "";
    private String detail = "";
    private String url = "";
    private boolean equipped = false;

    // Every possible attribute all the equipment in the game can have
    private String flavor = "";
    private int level = 0;
    private int gold = 0;
    private int silver = 0;
    private int copper = 0;
    private String magicItemType = "";
    private String weight = "";
    private int count = 0;
    private String tier = "";
    private String armor = "";
    private String weapon = "";
    private String itemSlot = "";
    private String requirement = "";
    private String critical = "";
    private String special = "";
    private String power = "";
    private String rarity = "";
    private String monster = "";
    private String enhancement = "";
    private String grantedPowers = "";
    private String tags = "";
    private String range = "";
    private String damage = "";
    private String proficiencyBonus = "";
    private String primaryEnd = "";    
    private String weaponCategory = "";
    private String handsRequired = "";
    private String group = "";
    private String properties = "";
    private String relatedElement= "";
    private String category= "";
    private String armorBonus= "";
    private String minimumEnhancementBonus= "";
    private String check= "";
    private String speed= "";
    private String armorType= "";
    private String armorCategory= "";
    private String property = "";
    private String description = "";
    private String fullText = "";
    private String type = "";
    
   
    public Equipment(String name) {
	this.name = name;
    }

    public String getHTML() {
	// If we have some special fields filled out then we have all we need to build our HTML from that.
	if (!flavor.equals("") || !category.equals("") || !weight.equals("")) {
	    buildHTML();
	    return html;
	}
	    
	if (url == "")
	    return "";
	if (html == null) {
	    EquipmentCompendiumEntry com = new EquipmentCompendiumEntry(this);
	    html = com.getHTML();
	}
	return html;
    }

    public boolean isEquipped() {
        return equipped;
    }

    public void setEquipped(boolean equipped) {
        this.equipped = equipped;
    }

    public String getHtml() {
        return html;
    }

    public void setHtml(String html) {
        this.html = html;
    }

    public String getFlavor() {
        return flavor;
    }

    public void setFlavor(String flavor) {
        this.flavor = flavor;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public int getGold() {
        return gold;
    }

    public void setGold(int gold) {
        this.gold = gold;
    }

    public String getMagicItemType() {
        return magicItemType;
    }

    public void setMagicItemType(String magicItemType) {
        this.magicItemType = magicItemType;
    }

    public String getTier() {
        return tier;
    }

    public void setTier(String tier) {
        this.tier = tier;
    }

    public int getSilver() {
        return silver;
    }

    public void setSilver(int silver) {
        this.silver = silver;
    }

    public int getCopper() {
        return copper;
    }

    public void setCopper(int copper) {
        this.copper = copper;
    }

    public String getWeight() {
        return weight;
    }

    public void setWeight(String weight) {
        this.weight = weight;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public String getRange() {
        return range;
    }

    public void setRange(String range) {
        this.range = range;
    }

    public String getDamage() {
        return damage;
    }

    public void setDamage(String damage) {
        this.damage = damage;
    }

    public String getProficiencyBonus() {
        return proficiencyBonus;
    }

    public void setProficiencyBonus(String proficiencyBonus) {
        this.proficiencyBonus = proficiencyBonus;
    }

    public String getPrimaryEnd() {
        return primaryEnd;
    }

    public void setPrimaryEnd(String primaryEnd) {
        this.primaryEnd = primaryEnd;
    }

    public String getWeaponCategory() {
        return weaponCategory;
    }

    public void setWeaponCategory(String weaponCategory) {
        this.weaponCategory = weaponCategory;
    }

    public String getHandsRequired() {
        return handsRequired;
    }

    public void setHandsRequired(String handsRequired) {
        this.handsRequired = handsRequired;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }

    public String getProperties() {
        return properties;
    }

    public void setProperties(String properties) {
        this.properties = properties;
    }

    public String getRelatedElement() {
        return relatedElement;
    }

    public void setRelatedElement(String relatedElement) {
        this.relatedElement = relatedElement;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getArmorBonus() {
        return armorBonus;
    }

    public void setArmorBonus(String armorBonus) {
        this.armorBonus = armorBonus;
    }

    public String getMinimumEnhancementBonus() {
        return minimumEnhancementBonus;
    }

    public void setMinimumEnhancementBonus(String minimumEnhancementBonus) {
        this.minimumEnhancementBonus = minimumEnhancementBonus;
    }

    public String getCheck() {
        return check;
    }

    public void setCheck(String check) {
        this.check = check;
    }

    public String getSpeed() {
        return speed;
    }

    public void setSpeed(String speed) {
        this.speed = speed;
    }

    public String getArmorType() {
        return armorType;
    }

    public void setArmorType(String armorType) {
        this.armorType = armorType;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getFullText() {
        return fullText;
    }

    public void setFullText(String fullText) {
        this.fullText = fullText;
    }

    public String getArmorCategory() {
        return armorCategory;
    }

    public void setArmorCategory(String armorCategory) {
        this.armorCategory = armorCategory;
    }

    public String getProperty() {
        return property;
    }

    public void setProperty(String property) {
        this.property = property;
    }

    public String getArmor() {
        return armor;
    }

    public void setArmor(String armor) {
        this.armor = armor;
    }

    public String getWeapon() {
        return weapon;
    }

    public void setWeapon(String weapon) {
        this.weapon = weapon;
    }

    public String getItemSlot() {
        return itemSlot;
    }

    public void setItemSlot(String itemSlot) {
        this.itemSlot = itemSlot;
    }

    public String getRequirement() {
        return requirement;
    }

    public void setRequirement(String requirement) {
        this.requirement = requirement;
    }

    public String getCritical() {
        return critical;
    }

    public void setCritical(String critical) {
        this.critical = critical;
    }

    public String getSpecial() {
        return special;
    }

    public void setSpecial(String special) {
        this.special = special;
    }

    public String getPower() {
        return power;
    }

    public void setPower(String power) {
        this.power = power;
    }

    public String getRarity() {
        return rarity;
    }

    public void setRarity(String rarity) {
        this.rarity = rarity;
    }

    public String getMonster() {
        return monster;
    }

    public void setMonster(String monster) {
        this.monster = monster;
    }

    public String getEnhancement() {
        return enhancement;
    }

    public void setEnhancement(String enhancement) {
        this.enhancement = enhancement;
    }

    public String getGrantedPowers() {
        return grantedPowers;
    }

    public void setGrantedPowers(String grantedPowers) {
        this.grantedPowers = grantedPowers;
    }

    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    public String toString() {
	return name;
    }

    public int getId() {
	return id;
    }

    public void setId(int id) {
	this.id = id;
    }

    public String getName() {
	return name;
    }

    public void setName(String name) {
	this.name = name;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    // buildHTML should only be called when we have flavor set up already
    // so return if that is not true
    private void buildHTML() {
	if (flavor.equals("") && category.equals("") && weight.equals(""))  return;
	
	
	html="<div id=\"detail\">\n";
	
	if (type.equals("Magic Item")) {
	    html += "<h1 style=\"font:aerial;font-size:1.35em;font-weight: bold;line-height:2;padding-left:15px;margin:0;color:white;background: #d8941d;\" class=\"magicitem\">"+name+"<br/>\n";
	    html += "<span class=\"milevel\">Level "+level+" "+rarity+"</span></h1>\n";
	    if (!flavor.equals("")) html += "<p class=\"flavor\"><i>"+flavor+"</i></p>\n";
	    if (gold != 0) html += "<p><b>Price</b>: "+gold+" gp<br/>\n";
	    if (!weapon.equals("")) html += "<b>Weapon</b>: "+weapon+"<br/>\n";
	    if (!armor.equals("")) html += "<b>Armor</b>: "+armor+"<br/>\n";
	    if (!enhancement.equals("")) html += "<b>Enhancement</b>: "+enhancement+"<br/>\n";
	    if (!critical.equals("")) html += "<b>Critical</b>: "+critical+"<br/>\n";
	    if (!power.equals("")) html += "<b>Power</b>: "+power+"<br/>\n";
	    if (!property.equals("")) html += "<b>Property</b>: "+property+"<br/>\n";
	}
	else {
	    html += "<h1 style=\"font:aerial;font-size:1.35em;font-weight: bold;line-height:2;padding-left:15px;margin:0;color:white;background: #1d3d5e;\" class=\"player\">"+name+"</h1><br/>\n";
	    if (!category.equals("")) html += "<b>Category</b>: "+category+"<br/>\n";
	    if (gold != 0) html += "<b>Price</b>: "+gold+" gp <br/>\n";
	    if (!weight.equals("")) html += "<b>Weight</b>: "+weight+" lb<br/>\n";
	    if (!armorBonus.equals("")) html += "<b>Armor Bonus</b>: "+armorBonus+"<br/>\n";
	    if (!minimumEnhancementBonus.equals("")) html += "<b>Minimum Enhancement Bonus</b>: "+minimumEnhancementBonus+"<br/>\n";
	    if (!check.equals("")) html += "<b>Check</b>: "+check+"<br/>\n";
	    if (!speed.equals("")) html += "<b>Speed</b>: "+speed+"<br/>\n";
	    if (!special.equals("")) html += "<b>Special</b>: "+special+"<br/>\n";
	    if (!range.equals("")) html += "<b>range</b>: "+range+"<br/>\n";	    
	    if (!damage.equals("")) html += "<b>Damage</b>: "+damage+"<br/>\n";
	    if (!description.equals("")) html += "<b>Description</b>: "+description+"\n";
	}
	
	html += "</div>";

	


    }    
}
